package com.woniuxy.qiantai.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniuxy.qiantai.entity.Shop;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author firstGroup
 * @since 2023-02-22 09:45:58
 */
@Mapper
@Repository
public interface ShopMapper extends BaseMapper<Shop> {
    @Select("SELECT shop_id as id,name,detail,img_src imgSrc\n" +
            "FROM t_type \n" +
            "INNER JOIN t_shop ON t_type.shop_id= t_shop.id\n" +
            "WHERE type_name = #{typeName} ")
    @ResultType(Shop.class)
    Page<Shop> selectShopByType(Page<Shop> page, @Param("typeName") String typeName);
    @Select("SELECT shop_id as id,name,detail,img_src imgSrc\n" +
            "FROM t_type \n" +
            "INNER JOIN t_shop ON t_type.shop_id= t_shop.id\n" +
            "WHERE type_name = #{typeName} ")
    @ResultType(Shop.class)
    List<Shop> selectShopByType(@Param("typeName") String typeName);
}
